Repository navigation
Conversation
…irmish-flow Their best match lives only on gynt's catch-all branches, which are ~2080 cpp files ahead of their merge base and 412 commits behind main. The cpp files are copied unchanged, without the headers of those branches: - gynt/reimpl/UI-Core-development@10280b161 (1) - gynt/reimpl/UI-DisplayElements-pr-development@fbc092e15 (15) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
Renamed fields, globals and resolvers by address, enum-typed arguments, array fields indexed directly, clang-format. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
SHC_3BB0A8C1_0x0044B680 48.7% ComputePlayerRanking SHC_3BB0A8C1_0x00490060 94.4% restoreSkirmishLobbySetup SHC_3BB0A8C1_0x004968A0 55.6% loadOrSaveGame SHC_3BB0A8C1_0x004BC110 28.9% adjustEventMonthAndYearForSection1047 SHC_3BB0A8C1_0x004BD800 32.9% Tutorial_IsActionAllowed SHC_3BB0A8C1_0x004BDE40 62.4% computeMissionCompletionScore SHC_3BB0A8C1_0x004C13F0 48.1% spawnInvasionEventAttackWave SHC_3BB0A8C1_0x004C31A0 26.9% processSingleplayerEvents SHC_3BB0A8C1_0x004C62C0 43.3% loadMap SHC_3BB0A8C1_0x004C6820 3.7% loadMapSiegeHeaderForMissionIndex SHC_3BB0A8C1_0x004C6880 26.3% loadMissionMapAndSetLord SHC_3BB0A8C1_0x004C68D0 44.8% SetupSkirmishMode SHC_3BB0A8C1_0x004C6B20 92.4% LoadSkirmishCampaignData SHC_3BB0A8C1_0x004D52A0 17.0% StoreGameIntoSKMasters SHC_3BB0A8C1_0x004D5370 16.4% SkirmishLeaderboard_DeleteEntry SHC_3BB0A8C1_0x004D9400 42.6% Skirmish_PrepareLeaderboardView Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
- loadMissionMapAndSetLord 26.3 -> 100: the parameter itself is decremented and passed back as missionNumber + 1; four else-if arms load the map. - LoadSkirmishCampaignData 92.4 -> 100: memset for the player positions, indexed AI loop. - loadMapSiegeHeaderForMissionIndex 3.7 -> 100 (call targets only): the original returns after the first matching bound; ours called the loader up to four times. The header types the index as char*. - restoreSkirmishLobbySetup 94.4 -> 99.3: strcpy for the map name, the selection sum read back from the stored globals. Left: [eax+esi] operand order. - StoreGameIntoSKMasters 17.0 -> 87.4: control flow rebuilt from the original. Left: the original re-reads the count after each struct copy, which happens when count and entries are one struct (version, count, entries are adjacent). - adjustEventMonthAndYearForSection1047 28.9 -> 74.7: every arm re-stores yearCopy, mission 18 returns without the month check, the test is month >= 12. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…e improved - Tutorial_IsActionAllowed: rebuilt from the original jump table. The step arms fall through to one shared return FALSE (an `if (c) return TRUE; return FALSE;` per arm becomes sete), and DAT_00df5590 is compared signed. Left: cases 3 and 4 keep their shared tail in the other arm. - ComputePlayerRanking 48.7 -> 53.8: the points table has 10 rows and the dead list 10 slots, as the original zeroes them. Left: playerID kept in ebp. - SetupSkirmishMode 44.8 -> 47.6: memset for the positions, indexed AI loop and a signed start date, as in LoadSkirmishCampaignData. Left: the original divides by 12 with idiv and keeps 1 and -1 in callee-saved registers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
16.4 -> 34.5. The original copies each entry with rep movsd, which is a struct assignment, not the decompiler's dword loop. The original re-reads the entry count after every copy. The count (0xdf624c) sits directly before the array (0xdf6250), so the original most likely declared both as one struct, where a store into an entry may alias the count. With two separate globals MSVC hoists the count and counts the loop down instead. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
55.6 -> 62.9, plus a behaviour fix. - The original writes DAT_ArrayOfMapIndices[i] = i and DAT_ArrayOfMapIndices2[i - 1] = 1 (esi + 0x880 + 4i and esi + 0x1050 + 4i). The ported code wrote both one entry low, so every multiplayer save shifted by one and entry 0 was never written. Indices2 is indexed by the 1-based map number, as everywhere else. - paths_getSavesPath is called directly, as paths.cpp already notes: the resolver call cannot use return value optimisation. Each arm otherwise copied a temporary string, which doubled the frame (0x74 against the original's 0x3c). - The dialog-clear case returns early, and the multiplayer (.msv) arm comes first, as in the original. What is left is register roles: the original keeps 1 in edi and the string's small-buffer limit 0x10 in ebp. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
42.6 -> 86.1, plus a behaviour fix. - The mission column sorted twice for filter 1 with entries present. The decompiler duplicated the sort call into the loop's guard, but the original reaches one sort call from both sides. - Every arm counts in INT_00eb9b60 and reads the entry count from its global, which is why the original reloads both after the name lookup call. - The sort-column arms return one by one, and the stored-order arm tests `<= 1`. - The backwards walk keeps a separate trip counter, as the original's `sub esi, 1; jne` does. - The date key goes to INT_ARRAY_00ed2be0[n]; the decompiler addressed it as INT_00ed2bdc[n + 1]. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
47.0 -> 47.7, plus a behaviour fix.
- The ported loop was `do { } while (true)` with no exit: after slider
24 it played the video and then carried on reading past the slider
array forever. The original leaves the loop at slider 25 and plays
the video once.
- Slider 24 reads invasionPoint (25 sliders over 24 counts), as the
original does.
- The video choice is a switch on crusaderArabian. The original resets
eventsCount once, after it.
What is left is block layout. Our compiler threads each switch arm
straight past the siege-engine compare chain, while the original jumps
every arm to one shared `divisor = 10` block ahead of the chain.
Declaring the locals outside the loop, wrapping the body instead of
using continue, separate ifs and += all compiled the same.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
43.3 -> 77.6, plus a behaviour fix. - Ghidra's `missionNumber1to20 - 4294967280 < 5` is an unsigned literal, so it computed x + 16 and missions 16-20 never called adjustEventMonthAndYearForSection1047. The original tests `x - 16 <= 4`. - The original has a /GS cookie. The two mapAndTime fields at 0xf0/0xf4, saved side by side right under it, are kept as an 8-byte char buffer, which gives the cookie and the 0x34 frame. - The events-extra zeroing is a for loop (rep stosd); memset of 32000 bytes became a call. - The mission 1 unit loop names each field through units[i]; a Unit& reference unrolled it three times. - Recruitability and producibility are read from the global DAT_MapPropertiesState instance, as the original does. - The euroRecruitableCopy flags are all zeroed, then set per recruitable unit, matching the original's stores. - The restore order of sword/pike and jester/lady puts every saved value in the original's stack slot. Load scheduling in the prologue is what is left. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
62.4 -> 71.6. The goto chains become a loop over the events: - A timed goal sets the deadline. - Only the last win condition counts: a later one supersedes it. - Each goal condition adds an objective: four goods conditions (6, 17, 5, 7) with the per-good switch, then gold and population. - The Builder-mode test reads SEC_U3_MapType2_1 from the global instance, as the original does. - The unit loops index units[i] directly. What is left: - The event loop's base pointer is anchored at conditions[0].enabled in the original and at ScenarioEventType in ours. - The *5 goods arm shares the default arm's store in the original. A goto into the default arm reproduced that in quick_diff, but reccmp measured it lower (70.7), so it is not used. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
47.6 -> 51.9. - Pointer walks become indexed loops, and memset, strcpy and the struct fields are named. - The per-player reset loop is bounded with `!=`: a `< 9` bound unrolls it into 27 stores, while the original keeps it a loop. What is left is register choice. The original keeps -1 in ebx for the loop, skirmishRelated1 and the team fill, keeps the mission pointer in esi, and pushes ebp only around the AI loop. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
74.7 -> 100. Moving militaryCampaignStage = 0 to the top lets the compiler schedule the month read, the zero and the mission test as the original does. Found by trying all 120 orders of the five opening stores. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The siege engines were tested with an else-if chain, which our compiler jump-threads from the slider switch arms straight to each add. A switch on troopType keeps the arms going through the shared tail as the original does; it now lowers to a jump table where the original has compares, which is what is left. 47.7% -> 91.0%. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
- The event type is a switch laid out case 3, case 2, case 1 as the original; the invasion arm was tested first. - The repeat offset is `rng % (months / 4)` with a signed divide as the original's cdq/and 3/sar 2; the unsigned `>> 2` was both wrong for the signed short RNG and the reason our compiler merged the repeat blocks. - Return early outside solitary games so the campaign update is a tail jump, and scope the spawn-location out-params to the lion case: an address-taken function-scope local disabled every tail call. - The playerDeathRelated != 0 (win/lose) arm comes first, as laid out. 26.9% -> 47.4%. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The original returns after the campaign-mission arm, after the economic-campaign arm and after the builder arm's multiplayer branch. Ghidra's version fell through, so a won campaign mission also ran incrementMission and redrew the banner twice more. Rewritten from the asm; SEC_U3_MapType2_1 is read through the global as the original does. The condition switch cases are in the original's jump-table target order. 47.4% -> 49.0%. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The hit-count conditions test the player byte for non-zero first, and the sortEventsByDate block is a flat chain in the order the original tests it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The original evaluates playEventVideoBik(getText(..), video, wav) as one call; Ghidra's pcVar locals for its arguments are gone, and the fire warning tests for a well before a water pot as the original does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
Each crusader/arabian arm makes its own playEventVideoBik call as the original does, and the stolen-food video is a nested call as well; the pcVar locals left without a use are removed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The two scans for a later invasion that is already due index the event array as the original does (imul by the event size) and name the header fields instead of walking Ghidra's int pointer. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The original reads the filter flag through the counter (arr[left - 1], walked by pointer) and stores the index, guarded by a signed i >= 0. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…ence The condition's enabled, subType and value bytes come from a ScenarioEventCondition reference instead of raw offsets into the event data, and the case-2 lord-killed test falls into the shared not-met store the way the original lays it out before the loop latch. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
Ghidra's bVar24/bVar23 sign-flag pairs become `if (a >= b)` with the met and not-met stores in each case, and the dead jump into the shared flag test goes away. The original compiles each to a cmp feeding one shared jl, which this now reaches more often. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The decompiler routed every year increment through the reused condition-flag pointer; write it as a direct field update instead. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…obal 0x00DF6248..0x00EB0AB0 is one block in the original: the float version, the entry count and the 250 SkMasterDataEntry records. As three separate globals the compiler knows a copied entry cannot overwrite the count and keeps it in a register; the original re-reads it after every struct copy, which is what it does for a variable index into one object. The three resolvers become DAT_SkMasters2Data (IO::SkMasters2Data) and every user moves to its fields. Matches with the new layout: SkirmishLeaderboard_DeleteEntry 34.5 -> 100, StoreGameIntoSKMasters 87.4 -> 100; readSkMasters2, WriteSkMasters2, Skirmish_SortAIOpponentOrder and MenuItemActionHandler_RankingGames_Main still differ only in labels. The Ghidra project still has the three separate labels, so the next header import will regenerate them unless the struct is applied there. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…global Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…uses The month rollover and the invasion counter wrap test `>= 12` and `>= 50` (cmp 0xc / 0x32; jl), not Ghidra's `0xb <` and `0x31 <`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The original stores 0 to field133_0x145d8 before testing which goal conditions are set, and compares the pending-invasion month as `month > event.month`. Restoring the store keeps the two `= 1` arms apart as in the original (the polarity flip at 0x4c41cc is gone); the match is unchanged to one decimal. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
The original never merges the stack cleanup of the two banner calls and keeps a separate epilogue copy per game mode: each arm makes one call and then joins a common `call; return`, which MSVC duplicates into its predecessors. Writing the modes as an else-if chain ending in that shared call reproduces it, and the builder arm's early exit becomes an else. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ
…tusRelated -> aiHoldBackTicks After the merge of origin/main all 7 functions at 100% stay 100% (normalized), and the partial ones keep their match. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gynt
added a commit
that referenced
this pull request
Dec 3, 2026
…eb9c9 header syncs (#546) * Fix eight files that stopped compiling after the efea7fc header sync The Ghidra sync efea7fc renamed PlayerData::aiControlStatusRelated to aiHoldBackTicks (the same int at 0x2274). migrateGameStateForMapVersion, setAIControlStatusTo100000 and six Update* unit functions still used the old name; they move to main's name. No header or status line changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix eight more files that stopped compiling after the Ghidra syncs The syncs 6823e33 and 1feb9c9 renamed or merged four more things that eight files still used: - Entity's short at 0xB0: unkMinusOne -> blendStrength (setEntityParameters, tickEntityDecayCounter). - The global at 0x00ED3154: DAT_00ed3154 (undefined4) -> INT_00ed3154 (int), with its header (ApplyBlending, BlitMapImageWithVerticalClip, RenderTerrainTilesCenterPiece). - MenuTextInputState's method at 0x004917C0: meth_0x4917c0 -> closeAllModalDialogs (MenuItemActionHandler_General_LaunchOrQuitMultiplayerGameUnk). - The three SkMasters2 globals (version, count, entries) are now one struct, DAT_SkMasters2Data at 0x00DF6248 (ReadSkMasters2, WriteSkMasters2). No header or status line changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix five more files after the syncs, with lines from gynt's open PRs The syncs typed three things these files pass or compare as plain numbers, and merged the SkMasters2 globals: - SetStorageMarketFailState takes a StorageMarketFailStateEnum: the SMFS_ names for the numbers it is given and the states compared after it (MenuItemActionHandler_AlliesSendAndRequestGoods_Main, MenuItemActionHandler_BuildingAndStatusMenu_BuySellMenuButtonsAndHands), as in gynt's #295. - The plateau call's fourth parameter is a Logic2: a cast on DAT_GameCommandParam3 (ClickCreatePlateau), as in gynt's #396. - DAT_SkMasters2DataArray is DAT_SkMasters2Data's entries (Skirmish_SortAIOpponentOrder, MenuItemActionHandler_RankingGames_Main), as in gynt's #525 and #529. The hunks are gynt's, unchanged, so those PRs merge with this one. Co-authored-by: Gynt <gynt@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Gynt <gynt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…regs) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…lloc) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…rame Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…te; r Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…ondit Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
… star Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…v reg Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…ed, f Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
gynt
added a commit
to gynt/OpenSHC
that referenced
this pull request
Dec 4, 2026
SkirmishLobbySetupStructure::restoreSkirmishLobbySetup. Text from draft sourcehold#525 (reimpl/mission-skirmish-flow), with the style pass from REIMPLEMENTATION_STYLE_GUIDE.md. Measured on main 592a17d with a full build of the ten files of this PR (plus IO/ResourceManager/paths.cpp as a callee for the link) and reccmp: 99.3 / 95.2. The only difference is the operand order of one byte store, mov byte ptr [eax + esi], dl in the original against [esi + eax] in ours: the same address, so no change in behaviour. The two unrolled copy loops are for-loops with countof; MSVC unrolls them as the original. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
gynt
added a commit
to gynt/OpenSHC
that referenced
this pull request
Dec 4, 2026
MenuTextInputState::loadOrSaveGame. Text from draft sourcehold#525 (reimpl/mission-skirmish-flow), with the style pass from REIMPLEMENTATION_STYLE_GUIDE.md. Measured on main 592a17d with a full build of the ten files of this PR (plus IO/ResourceManager/paths.cpp as a callee for the link) and reccmp: 93.1 / 93.5. The original keeps the constant 16 in ebp and uses it for both std::string capacity checks and the fileListVisibleRowCount store; ours uses the immediate each time. The rest follows from that: the longer immediate encodings shift the relative jump offsets, the loop's alignment filler is a jmp over padding instead of lea esp, [esp], and the call and handler targets differ only as labels. No change in behaviour. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…ructure Structural pass on processSingleplayerEvents (arm order already matched the original in all three jump tables, so the work is inside the arms): - condition loop counts conditions before the switch; the 0x27 arm compares against count - 1, the decompiler's double counter is gone - condition 8 scans later invasion events by index instead of a raw pointer - conditions 5, 6/0x11, 7 each carry their own subType branch; MSVC tail-merges them into the copy in case 5 like the original - map type read through the global instance where the original does - invasion: difficulty and crusader/arabian dispatch are switches, the score bytes are added in place, spawn clamp compares in the original's order - the three-months-ahead warning loop walks scenarioEvents by index; the old pointer stepped 0x72 events at a time instead of one (behaviour fix) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…ndex loops - actions 0x1d/0x1e call playEventVideoBik in each branch instead of picking the text id first; the original has separate pushes per branch that MSVC only produces from duplicated calls (tail-merged at the shared call) - spreadFireRandomlyToBuildings takes the player slot explicitly instead of a stale iVar18 holding the same value - conditions 0xc, 0x12, 0x13 count units/buildings with index loops over the named fields instead of pointer walks with raw offsets - condition 0x27 tests the remaining time as <= 0 - repeat tail decrements the event index before sorting, as the original does Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…ion, switches - resource and hit-count sums are written highest index first; MSVC evaluates the chain from the right, so this gives the original's load order - conditions 0xd/0xe compare the hit count against the target (count >= value) like the original's cmp [hits], value; jl - the three-months-ahead warning loop and the next-month countdown loop dispatch on tl_type with a switch: the original tests it with sub reg,1; jne and reuses the zero, which a plain == 1 test does not give - invasion signpost index wraps with local_88 >= count Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…ed fields - the action switch no longer preloads the player slot into iVar18; actions 0xb, 0x15, 0x16 read currentPlayerSlotID themselves, which is what the original does (every arm reloads it) - raw data+offset casts replaced with the fields they hit: conditions[0x27].value, allOrAnyCondition, conditions[n].enabled, invasion.crusaderArabian, invasion.unitCountsPerUnitType[] - action 0x1c (cancel repeating invasions) and the well/waterpot check walk by index over named fields instead of offset pointers; the 0x1c loop keeps the do/while shape, which compiles identically to the original Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
…emarks Measured with a full build and reccmp, both resolver sets on. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
16 mission, map-loading and skirmish-leaderboard functions, rewritten from the original binary. The functions were ported from gynt's catch-all branches: this branch is origin/main plus the copied files, compile fixes, matching work and status.
Measured with reccmp, with both the struct and the function resolvers enabled and main's /GL callees on.
7 of 16 functions at 100%. The others hit a wall: the blocker named for each was measured, and the source forms tried against it tied or scored worse.
At 100%
MapPropertiesState::adjustEventMonthAndYearForSection1047MapPropertiesState::loadMapSiegeHeaderForMissionIndexMapPropertiesState::loadMissionMapAndSetLordSynchrony::LoadSkirmishCampaignDataSkirmish::StoreGameIntoSKMastersSkirmish::SkirmishLeaderboard_DeleteEntrySkirmish::Skirmish_PrepareLeaderboardView(counted: only the labels of two array[-1] addresses differ)Hit a wall
SkirmishLobbySetupStructure::restoreSkirmishLobbySetup[edx+ecx]vs[ecx+edx]). Not reachable from source (75 variants measured on TileMapState).MenuTextInputState::loadOrSaveGame0x10inebpfor the string-capacity tests; ours uses immediates.Game::Tutorial_IsActionAllowedMapPropertiesState::spawnInvasionEventAttackWaveswitchbecomes a jump table whose arms MSVC threads past the following compare chain. The original's if-chain form measures 47.7 with our compiler.MapPropertiesState::computeMissionCompletionScore*5arm shares the default store in the original; the rest is register naming.MapPropertiesState::loadMapMapPropertiesState::processSingleplayerEventsSFX::ComputePlayerRankingplayerIDinebpas a fourth callee-saved register. A const copy, moved declarations and swapped compare orders all compile byte-identical.Skirmish::SetupSkirmishModeediand -1 inebx; ours uses immediates.i < 9,!= 9and if/else-if mission picks all measure worse.Behaviour fixes
These were wrong in the decompiler output and are fixed against the binary:
loadOrSaveGamewrote map indices one entry low.Skirmish_PrepareLeaderboardViewsorted twice.spawnInvasionEventAttackWavenever left itswhile (true).loadMap: Ghidra's unsigned literalmission - 4294967280 < 5ismission + 16, so missions 16-20 never adjusted their events.processSingleplayerEvents: Ghidra droppedreturns in the win/lose block, so the campaign arm fell through intoincrementMission.SkMasters2Dataglobal (same change as on ui-menuviews-modals-development).Type and header changes are in their own
types:commits. Resolver flags are not committed.🤖 Generated with Claude Code
https://claude.ai/code/session_01XmXCmXNCM9MzSpvzeakUrQ